package com.jacobson.huobi.mvp.model

import com.jacobson.core.di.annotation.ActivityScope
import com.jacobson.core.framework.repository.IRepositoryManager
import com.jacobson.core.mvp.BaseModel
import com.jacobson.huobi.api.SystemAlarmRecordApi
import com.jacobson.huobi.entities.response.AlarmRecordPageResponse
import com.jacobson.huobi.mvp.contract.AlarmRecordContract
import io.reactivex.Observable
import javax.inject.Inject

@ActivityScope
class AlarmRecordModel @Inject constructor(
    repositoryManager: IRepositoryManager
) : BaseModel(repositoryManager), AlarmRecordContract.Model {
    private val systemAlarmRecordApi =
        repositoryManager.obtainRetrofitService(SystemAlarmRecordApi::class.java)

    override fun loadSymbolRecordList(
        market: String,
        symbol: String,
        strategy: Int,
        period: String,
        lastTs: Long?
    ): Observable<AlarmRecordPageResponse> {
        return systemAlarmRecordApi.loadSymbolRecordList(
            market,
            symbol,
            strategy,
            period,
            lastTs ?: -1
        )
    }

}